Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 5 - Ink Objects / About Transfer Modes


Color Limits

Transfer mode operations allow you to specify limits on the acceptable input values for the source or destination color, and on the acceptable output values for the result color. For example, in converting CMYK color to RGB, you may wish to limit the intensities to values that can be displayed without oversaturating the phosphors on a monitor's screen. Or, to create a special effect, you may want to draw only the extreme light and dark portions of an image, leaving out its midrange entirely.

Each color component in the component field of the transfer mode structure can have a maximum and a minimum permitted value. The permissible ranges can be interpreted as shown in Figure 5-11. In the figure, the large cube represents all of RGB space; the small cube represents one possible example of the limits that could be imposed on allowable values for all three components.

Figure 5-11 Maximum and minimum color-component values in RGB space

In the case of source and destination colors, color values outside the range of acceptable values (that is, outside the small cube in Figure 5-11) are ignored; if any single component value is outside of its acceptable range, no drawing occurs at all for that color. In the case of the calculated colors that result from a given transfer mode operation, color values outside of the acceptable range are pinned to, or moved so that they don't exceed, the nearest acceptable value (the closest edge of the small cube). See Figure 5-12.

Figure 5-12 How minimum and maximum color limits affect drawing

For a given component, the maximum value for a color limit can be either greater or smaller than the minimum. If the maximum is less than the minimum, only the extreme color values (that is, values outside of the small cube area in Figure 5-11) are allowed. See Figure 5-13.

Figure 5-13 How reversed minimum and maximum color limits affect drawing

Each of the components in a color space can have its limits set entirely independently
of the others. Figure 5-14 shows the effects of reversing, in turn, the maximum and minimum values for each of the three axes in RGB space.

Figure 5-14 The effects of reversing maximum and minimum in a color space

Where the words Min and Max are bold in Figure 5-14, the minimum is greater than the maximum. Refer to Figure 5-11 on page 5-28 for the positions of the color axes on the RGB cube in this figure:

Source Color Limits

The sourceMinimum and sourceMaximum fields in a color component's gxTransferComponent structure define the allowable range of values for source color in that component. Color values outside of the range cause no drawing to occur. If sourceMaximum is less than sourceMinimum, the range allowed consists of values less than sourceMaximum or greater than sourceMinimum. Figure 5-15 shows the effect of sourceMinimum and sourceMaximum on drawing using blend mode.

Figure 5-15 The effect of source color limits on drawing

Note in Figure 5-15 that, when sourceMinimum is less than sourceMaximum, only the cloud in the source image is within the source limits, so only the cloud is blended with the destination image to create the result. Conversely, when sourceMaximum is less than sourceMinimum, the cloud in the source image is outside the source limits, so it is the only part of the source that is not blended with the destination image when creating the result.

Destination Color Limits

The deviceMinimum and deviceMaximum fields in a color component's gxTransferComponent structure define the allowable range of values for destination color in that component. Destination color values outside of the range cause no drawing to occur for that color. If deviceMaximum is less than deviceMinimum, the range allowed consists of values less than deviceMaximum or greater than deviceMinimum. Figure 5-16 shows the effect of deviceMinimum and deviceMaximum on drawing using blend mode.

Figure 5-16 The effect of destination color limits on drawing

Note in Figure 5-16 that, when deviceMinimum is less than deviceMaximum, only the letter "A" in the destination image is within the destination limits, so the source is blended with the destination image only within the limits of the "A" to create the result. Conversely, when deviceMaximum is less than deviceMinimum, the "A" is outside the destination limits, so it is the only part of the destination not blended with the source to create the result.

Result Color Limits

The clampMinimum and clampMaximum fields in a color component's gxTransferComponent structure define the allowable range of values for the result color in that component. Color values outside of the range are pinned to the nearest clamp limit. If clampMaximum is less than clampMinimum, the range allowed consists of values less than clampMaximum or greater than clampMinimum. Figure 5-17 shows the effect of clampMinimum and clampMaximum on drawing using blend mode.

Figure 5-17 The effect of result color limits on drawing

Note in Figure 5-17 that, when clampMinimum is less than clampMaximum, extreme color values cannot occur in the result. The portions of the "A" outside of the cloud are darker than they would normally be with blend mode, and the portions of the cloud outside of the letter are lighter than they would normally be. Conversely, when clampMaximum is less than clampMinimum, midrange values are not possible in the result. The background in the result is lighter than it would normally be with blend mode, and the portions of the cloud outside of the "A" are darker than they would normally be.

Note
Pinning restricts the value of the computation, not necessarily the value allowed for the actual pixel. The pixel value is the closest found to the computation, which may be outside of the range of clampMinimum and clampMaximum.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996